//
//  SetChatViewController.m
//  BGM
//
//  Created by liuqin on 2018/11/28.
//  Copyright © 2018年 com.alirtc.demo. All rights reserved.
//

#import "SetChatViewController.h"
#import "Common.h"
#import "MeTableViewCell.h"
#import "ChangePhoneNumViewController.h"

@interface SetChatViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, copy)NSArray *section1;
@property (nonatomic, copy)NSArray *section2;


@end

@implementation SetChatViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.navview.hidden = NO;
    self.titleBtn.hidden = NO;
    CGRect rect = self.titleBtn.frame;
    rect.size.width = rect.size.width+70;
    self.titleBtn.frame = rect;
    [self.titleBtn setTitle:@"通知与聊天" forState:UIControlStateNormal];
    
    self.section1 = @[@"被转发用私信通知",@"声音",@"振动"];
    self.section2 = @[@"被回车键发送消息"];

    UITableView *myTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, self.navview.frame.size.height, SCREENW, SCREENH-self.navview.frame.size.height)];
    myTableView.backgroundColor = [UIColor clearColor];
    myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    myTableView.delegate = self;
    myTableView.dataSource = self;
    myTableView.scrollEnabled = NO;
    [self.view addSubview:myTableView];
}
#pragma mark UITABLEVIEWDELEAGE

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 50;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, SCREENW, 50)];
    label.backgroundColor = [UIColor clearColor];
    label.font = [UIFont systemFontOfSize:16];
    label.textColor = bgmgrayColor;
    if(section ==0){
        label.text = @"   推送通知";
    }else{
        label.text = @"   聊天";
    }
    return label;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return section == 0 ? 3: 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *identifier = @"MeTableViewCell";
    MeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[MeTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        cell.iconBtn.hidden = NO;
        cell.contentLabel.frame = CGRectMake(15, 0, 300, 50);
        cell.line.hidden = YES;
    }
    
    if (indexPath.section==0) {
        cell.contentLabel.text = [self.section1 objectAtIndex:indexPath.row];
    }else{
        cell.contentLabel.text = [self.section1 objectAtIndex:indexPath.row];
    }
    
    
    
    return cell;
    
}



@end
